package com.yylending.assist;

import android.app.Application;
import android.text.TextUtils;
import com.yylending.las.Global;
import com.yylending.las.main.MainActivity;
import org.junit.Assert;
import org.robolectric.Robolectric;
import org.robolectric.TestLifecycleApplication;
import org.robolectric.android.controller.ActivityController;

import java.lang.reflect.Method;

/**
 * Created by HenryZhang on 2017/6/7.<br>
 * Copyright © 2017 www.yylending.com. All Rights Reserved.<br><br>
 */
public class LifecycleApplication extends Application implements TestLifecycleApplication {
	@Override
	public void beforeTest(Method method) {
		BasicTestRunner.asyncToSync();
	}

	@Override
	public void prepareTest(Object test) {
		ActivityController<MainActivity> mActivityController = Robolectric.buildActivity(MainActivity.class);
		MainActivity aty = mActivityController.create().visible().get();
		mActivityController.start();
		Assert.assertFalse(TextUtils.isEmpty(Global.KEY_RSA));
	}

	@Override
	public void afterTest(Method method) {
	}
}
